<%@ page pageEncoding="UTF-8" %>
<!doctype html>
<html lang="zh-cmn">
<head>
    <title>Document</title>
    <%@include file="/WEB-INF/jsp/header.jsp"%>
</head>
<style type="text/css">
    .one{
        height: 35px;
    }
    .one input{
        height: 35px;
        width: 270px;
    }
    .two{
        height: 70px;
    }
    .three{
        height: 60px;
    }
    .tt{
        font-size: 12px;
    }
    table input{
        background:-webkit-gradient(linear, 0% 0%, 0% 100%,from(#b8c4cb), to(#f6f6f8));
    }
</style>
<body>
    <div class="container-fluid" style="">
        <div class="text-center">
            <span class="h3">药品报损单</span>
        </div>
        <div class="text-center" style="margin-top: 20px;" >
            <form action="" id="destoryForm" class="form-inline" style="text-align: right" >
                <table border="1" class="text-center" style="margin: auto;width: 100%;background:-webkit-gradient(linear, 0% 0%, 0% 100%,from(#b8c4cb), to(#f6f6f8));">
                    <tr class="one">
                        <td class="">
                            报损单位:
                        </td>
                        <td class="" colspan="4">
                            <input type="text" style="border: 0;outline: none" placeholder="请在此输入报损单位!"  name="desUnit" />
                        </td>
                        <td class="" colspan="2">
                            销毁日期:
                        </td>
                        <td class="" colspan="2">
                            <input type="text" placeholder="请输入销毁日期" style="border: 0;outline: none" id="desDate"  name="desDate" />
                        </td>
                        <td class="" >
                            申请人:
                        </td>
                        <td class="" colspan="2">
                            ${sessionScope.loginUser.woName}
                            <input type="hidden" name="desAuditper" value="${sessionScope.loginUser.woJubnum}" />
                        </td>
                    </tr>
                    <tr class="two">
                        <td>
                            名称:
                        </td>
                        <td>
                            数量
                        </td>
                        <td>
                            单位
                        </td>
                        <td>
                            规格
                        </td>
                        <td>
                            单价
                        </td>
                        <td>
                            金额
                        </td>
                        <td>
                            购置时间
                        </td>
                        <td>
                            已使用年数
                        </td>
                        <td>
                            生产企业
                        </td>
                        <td>
                            报损原因
                        </td>
                        <td>
                            批号
                        </td>
                    </tr>
                    <!--信息省略-->
                    <c:forEach items="${list}" var="li">
                        <tr class="two tt">
                            <td>
                                <input name="stoNum" value="${li.stoNum}" type="hidden" />
                                ${li.druginfo.drugName}
                            </td>
                            <td>
                                ${li.stoPcs}
                            </td>
                            <td>
                                ${li.druginfo.drugUnit}
                            </td>
                            <td>
                                ${li.druginfo.drugStandard}
                            </td>
                            <td>
                                ${li.stoPresell}
                            </td>
                            <td>
                                ${li.stoPrimecost*li.stoPcs}
                            </td>
                            <td>
                                <fmt:formatDate value="${li.stoMfg}" pattern="yyyy-MM-dd" var="d"/>
                                ${d}
                            </td>
                            <td>
                                <fmt:formatDate value="${li.stoValiddate}" pattern="yyyy-MM-dd" var="dd"/>
                                ${dd}
                            </td>
                            <td>
                                ${li.provider.proName}
                            </td>
                            <td>
                                药品已过期
                            </td>
                            <td>
                                ${li.stoLotnum}
                            </td>
                        </tr>
                    </c:forEach>

                    <tr class="three">
                        <td>
                            变现价款
                        </td>

                        <td colspan="8">
                            <span class="text-left" style="display:block">合计:￥${money}</span>

                        </td>
                        <td>
                            处理方式
                        </td>
                        <td colspan="2">
                            <textarea rows="4" style="background:-webkit-gradient(linear, -20% 0%, 0% 100%,from(#b8c4cb), to(#f6f6f8));" id="desMode" name="desMode" cols="38" style="border: 0;"></textarea>
                        </td>
                    </tr>
                </table>
                <div class="text-center" style="margin-top: 20px;">
                    <button type="button" onclick="submitDestroy()" class="btn btn-primary">审核</button>
                    <button type="button" onclick="ReturnDestroy()" class="btn btn-danger">返回</button>
                    <p style="color: red;" id="error"></p>
                </div>
                <input type="hidden" name="desViews" value="" />
            </form>
        </div>
    </div>
<%@include file="/WEB-INF/jsp/footer.jsp"%>
<script>
    function submitDestroy() {
        var lossUnit = $("#destoryForm [name=desUnit]").val();
        var lossDate = $("#desDate").val();
        var desMode = $("#desMode").val();
        if(lossUnit==null || lossUnit==''){
            $("#error").html("报损单位不可以为空!")
            return;
        }else if(lossDate=null || lossDate=='') {
            $("#error").html("请填写销毁日期!")
            return;
        }else if(desMode==null || desMode==''){
            $("#error").html("请填写处理方式!")
            return;
        }else{
            var param = $("#destoryForm").serialize();
            var stoNum = $("#destoryForm [name=stoNum]");
            var array = new Array();
            $(stoNum).each(function () {
                array.push($(this).val());
            })

            location.href=ctx+"/stock/addDestock?"+param;
        }
    }
    //搜索日期插件
    $(function () {
        laydate.render({
            elem:'[name=desDate]'
        })
    });
    function ReturnDestroy() {
        location.href=ctx+"/stock/overdue/index"
    }
</script>
</body>
</html>
